package com.great.medical.common;


public enum StatusEnum {

    ENABLE(1, "启用"),
    DISABLE(0, "禁用")
    ;

    private final Integer code;
    private final String name;

    StatusEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static StatusEnum codeOf(Integer code) {
        for (StatusEnum status : StatusEnum.values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }

        throw new IllegalArgumentException(String.format("code %s is undefined.", code));
    }

}
